﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using Taxes.BLL;
using Taxes.Model;
using Ext.Net;

namespace Taxes
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            // Do some Authentication...
            if (txtUsername.Text.Trim() == "admin" && txtPassword.Text.Trim() == "admin")
            {
                var userInfo = new Model.ysys_user() { user_name = "admin", user_pwd = "admin", user_type = 1 };
                Session["curr_user"] = userInfo;
                Response.Redirect("Main.aspx");
            }
            else
            {
                var bll = new BLL.ysys_user();
                var userInfo = bll.Exist(this.txtUsername.Text.Trim(), this.txtPassword.Text.Trim());

                if (userInfo != null)
                {
                    Session["curr_user"] = userInfo;
                    Response.Redirect("Main.aspx");
                }
                else
                {
                    X.Msg.Alert("温馨提示", "用户名或密码错误").Show();
                }
            }
        }
    }
}